.POSIX:
PREFIX=		/usr/local
MANDIR=		man

HDR=	au.h
SRC=	au.c auplot.c

default: auplot
all: default README
auplot: ${SRC} ${HDR} Makefile
	${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${SRC}
install: default
	install -m 444 auplot.1 ${DESTDIR}${PREFIX}/${MANDIR}/man1/
	install -m 755 auplot ${DESTDIR}${PREFIX}/bin/
install-local: default
	install -m 755 auplot ${HOME}/bin/
README: auplot.1 Makefile
	mandoc -Ios= -Tutf8 auplot.1 |\
	    awk '{gsub(/.\b/,"");a=b;b=c;c=$$0}FNR>4{print a}' > $@
clean:
	rm -f auplot
clean-all: clean
	rm -f README
